import java.util.*;
import java.util.Stack;

public class Solution {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();
    //利用两个辅助栈实现队列
    public void push(int node) {
        //入队列存在栈1
        stack1.push(node);
    }

    public int pop() {
        //出队列需要放入另一个栈2把顺序颠倒
        if(stack2.isEmpty()){
            //放入栈2之前确保栈2为空
            while(!stack1.isEmpty()){
                stack2.push(stack1.pop());
            }
        }
        //如果栈2不为空直接从栈2出队列
        return stack2.pop();

    }
}
